
package biblio.dao;


import biblio.domain.Book;
import biblio.exception.NoSuchEntityException;
import java.io.Serializable;
import java.util.List;


/**
 * Interface for persistance of Book.
 * 
 * @author mephisto
 */
public interface BookDAO
{
/**
     * Persists book given as a parameter in the database.
     *
     * @param book the book to set, this entity will be persited in the database
     */
    void create(Book book);

    /**
     * Returns found books indentified by lastName in the database or throws
     * NoSuchEntityException if such books does not exist.
     *
     * @param title the title to set
     * @return Book which is identfied by title
     * @throws NoSuchEntityException if no Book is
     *         associated with this lastName
     */
    List<Book> find(Serializable title) throws NoSuchEntityException;

    /**
     * Returns found book indentified by id in the database or throws
     * NoSuchEntityException if such books does not exist.
     *
     * @param id the id to set
     * @return Book which is identfied by id
     * @throws NoSuchEntityException if no Book is
     *         associated with this id
     */
    Book getById(Integer id) throws NoSuchEntityException;

    /**
     * Returns the list of all books stored in the database. List is empty
     * when no entity is stored in the database.
     *
     * @return the list of all books stored in the database
     */
    List<Book> selectAll();

    /**
     * Updates found book in the database or throws
     * NoSuchEntityException if such book does not exist.
     *
     * @param book to set the book which will be updated
     * @throws NoSuchUserException if no User is associated with this id
     */
    void update(Book book) throws NoSuchEntityException;

    /**
     * Deletes book from the database if only exists.
     *
     * @param book to set the book which will be deleted
     */
    void delete(Book book);
}
